package com.hdu.mockService.service;

import com.hdu.mockService.factory.MockHandlerFactory;


public class MockService {
    public static <T> T mock(Class<T> clazz) {
        try {
            T mockObj = clazz.newInstance();
            MockHandlerFactory.getHandlers().forEach(handler -> handler.partitionMock(mockObj));
            return mockObj;
        } catch (InstantiationException | IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }
}
